Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add tests for some components #11910

Merged
merged 7 commits into from
Mar 4, 2024
Merged

Conversation

EshaanAgg
Copy link
Contributor

Summary

  • Added tests for the following components
    • TotalPoints
    • GenderDisplayText
    • GenderSelect

I am not testing the user interaction in the case of the GenderSelect component, as we are using a pre-defined component from the Kolibri library, and thus, it should be the duty of the KDS package to test the UI interactions and then export the components.

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@EshaanAgg EshaanAgg changed the title tests: All VTL tests for some components tests: Add tests for some components Feb 21, 2024
@MisRob MisRob requested review from MisRob and AlexVelezLl February 23, 2024 14:28
@MisRob MisRob self-assigned this Feb 27, 2024
test('renders correctly with label placeholder and options', async () => {
renderComponent();

expect(screen.getByText('Gender')).toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could use getByLabel, to diferentiate that this is the label of the input. And we can add an array of options that it should contain.

Also, the component is responsible for emitting events when a selected value changes, which could be another test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using getByLabelText does not work for this particular component. I suspect it's due to the markup that's surrounding it.

<div class="ui-select-label-text is-inline">
   Gender
</div>

Copy link
Member

@AlexVelezLl AlexVelezLl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EshaanAgg. Code looks good to me :) will let the final approve to @MisRob.

@MisRob
Copy link
Member

MisRob commented Mar 4, 2024

Ah I'm sorry, I assigned myself in hopes I would use this opportunity to learn more but I don't think I will get to it this week. Thanks for review @AlexVelezLl

Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @EshaanAgg

@MisRob MisRob merged commit 3f40ae0 into learningequality:develop Mar 4, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants